package com.qf.fmall2302.exhandler;

import com.qf.fmall2302.utils.FmallConstants;
import com.qf.fmall2302.vo.ResultVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice  // 这个注解会让当前类成为全局异常处理器
public class GlobalExHandler {

    @ExceptionHandler(Exception.class)
    public ResultVo handleEx(Exception e){

        e.printStackTrace();

        return ResultVo.error(FmallConstants.ERROR_COED, e.getMessage());

    }

}
